package DataSourse.c3p0;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @Author: ylc
 * @Description:c3p0演示
 * @Date Created in 2022-05-10 14:33
 */
public class c3p0Demo {
    public static void main(String[] args) throws SQLException{
        //1.获取DataSource,使用默认配置
        DataSource ds  = new ComboPooledDataSource();
        //使用指定名称配置
        //DataSource ds  = new ComboPooledDataSource("otherc3p0");
        //2. 获取连接对象
        Connection conn = ds.getConnection();
        //3. 打印
        System.out.println(conn);
    }

}
